<script setup lang='ts'>
	import {onLoad, onReady, onShow, onHide, onUnload, onPageScroll} from '@dcloudio/uni-app'
	import { onMounted, ref } from 'vue';
	
	const scroll = ref(null)
	const count = ref(0)
	
	let time = setInterval(() => {
		count.value++
	}, 50)
	
	onLoad((e) => {
		console.log('onLoad函数');
		// console.log(e);
	})
	
	onReady(() => {
		// console.log(scroll.value);
		console.log('onReady函数');
		
	})
	
	onShow(() => {
		console.log('onShow函数');
		time = setInterval(() => {
			count.value++
		}, 50)
	})
	
	onHide(() => {
		console.log('onHide函数');
		clearInterval(time)
	})
	
	onUnload(() => {
		console.log('onUnload函数');
	})
	
	onPageScroll((e) => {
		console.log(e.scrollTop);
	})
	
</script>


<template>
	<view>
		<view class="demo2">
			demo2
		</view>
		<scroll-view scroll-y="true" ref="scroll">
			<view>{{count}}</view>
		</scroll-view>
		<navigator open-type="reLaunch" url="/pages/demo1/demo1">去demo1</navigator>
		<view v-for="item in 30">{{item}}</view>
	</view>
</template>


<style scoped lang='scss'>
	.demo2{
		color: $uni-color-primary;
	}
</style>
